using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace THANHTUNGO.Portal.Modules.DOWNLOAD.Components
{
    public partial class Category
    {
        public static DataSet SelectBy_ParentID(int parentID)
        {
            string spName = "p_DOWNLOAD_Category_SelectBy_ParentID";
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand(spName);
            db.AddInParameter(dbCommand, "@ParentID", DbType.Int32, parentID);
            return db.ExecuteDataSet(dbCommand);
        }

        public static DataSet SelectRootBy_ModuleID(int moduleID)
        {
            string spName = "p_DOWNLOAD_Category_SelectRootBy_ModuleID";
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand(spName);
            db.AddInParameter(dbCommand, "@ModuleID", DbType.Int32, moduleID);
            return db.ExecuteDataSet(dbCommand);
        }
    }
}